fix(history): never write .agent_history into the project tree - #439
Open
openjiuwen-sync-bot[bot] wants to merge 1 commit into
Open
fix(history): never write .agent_history into the project tree#439openjiuwen-sync-bot[bot] wants to merge 1 commit into
openjiuwen-sync-bot[bot] wants to merge 1 commit into
Conversation
_build_history_path fell back to the project CWD when no agent workspace was configured, so tool history (.agent_history/*.json) was written into the user's project directory, polluting their execution environment (#1490). Add get_agent_history_base_dir() in cwd.py: prefers the agent workspace; when none is configured, falls back to ~/.openjiuwen/agent_history instead of the CWD. All four _build_history_path call sites (write_file, edit_file, bash, powershell) now use it. Closes #1490. Co-Authored-By: AtomCode (deepseek-v4-flash) <noreply@atomgit.com>
|
|
|
head_sha: 变更摘要此 PR 修复了 #1490 问题:当 agent 未配置 workspace 时, 主要改动
|
|
head_sha: 代码审查✅ 未发现问题 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Paired: GitHub #439 ↔ GitCode !2263
Summary
Fixes #1490:
.agent_historywas written into the user's project directory when no agent workspace was configured, polluting their execution environment.Root cause
_build_history_pathin four tools used:When
get_workspace()returnsNone(agent without a workspace), history files landed in the project CWD — i.e. inside the user's project tree.Change
openjiuwen/core/sys_operation/cwd.py: newget_agent_history_base_dir()— prefers the agent workspace; when none is configured, falls back to~/.openjiuwen/agent_historyinstead of the CWD.openjiuwen/harness/tools/filesystem.py(write_file + edit_file),shell/bash/_tool.py,shell/powershell/_tool.py: all four_build_history_pathcall sites now use the helper.Tests
tests/unit_tests/core/sys_operation/test_cwd.py:~/.openjiuwen/agent_history, and not the project CWDVerification
uv run pytest tests/unit_tests/core/sys_operation/test_cwd.py— 2 passed_build_history_pathtests (bash/powershell/filesystem) still pass; the unrelatedtest_timeout_returns_collected_outputfailure on Windows is pre-existing (the environment lacks GNUsleep, soecho partial; sleep 5returns immediately with exit 0) and is not touched by this PR.Linked Closing Issues: